<?php
/**
 * スコアＸＭＬデータモデルモジュール
 */
require_once __DIR__ . '/../ScoreController.php';

/**
 * スコアＸＭＬデータモデル
 * @link https://www.evernote.com/view/8c8b2ccc-a378-471d-b521-b165a9b2083d?locale=ja#b=90ccea2f-37a9-463f-89cf-099ea98d1d1f&n=8c8b2ccc-a378-471d-b521-b165a9b2083d
 */
class Models_Score_Xml_Controller extends Models_Score_Controller
{
	/** ゲームＩＤ */
	protected $_GameID;

	/**
	 * コンストラクタ
	 * @param $GameID ゲームＩＤ
	 */
	public function __construct($GameID)
	{
		$this->_GameID = $GameID;
		$this->_strFileName = __DIR__ . '/databox/' . $GameID . '.xml';
		if ( file_exists($this->_strFileName) ) {
			$this->loadFromFile($this->_strFileName);
		}
	}
	public function saveToFile($FirstHalfPoint, $FirstHalfLost, $SecondHalfPoint, $SecondHalfLost)
	{
		$this->clear();
		$this->_aryDataSet[]
		= array(
				self::KEY_ID => $this->_GameID,
				self::FIRST_HALF_POINT=>$FirstHalfPoint,
				self::FIRST_HALF_LOST=>$FirstHalfLost,
				self::SECOND_HALF_POINT=>$SecondHalfPoint,
				self::SECOND_HALF_LOST=>$SecondHalfLost
				);
		parent::saveToFile();
	}
}